/// <reference path="../../wx/ad/WxVideoAd.ts" />
namespace mplat {
    export class XmVideoAd extends WxVideoAd {

        protected _videoAd: any;

        protected _getVideoAd(id?: string) {
            if (!this._videoAd) {
                this._videoAd = qg.createRewardedVideoAd({
                    adUnitId: id || this._info.ids[0]
                });
                this._videoAd.onError(this._onVideoErr.bind(this))
                this._videoAd.onLoad(this._onVideoLoaded.bind(this))
                this._videoAd.onClose(this._onVideoClose.bind(this))
            }
            return this._videoAd;
        }

        protected _canUseVideo(){
            return !!qg.createRewardedVideoAd
        }
        protected _createdAd() {
            if (!this._videoAd) return;
            this.loadVideoAd();
        }

    }
}